﻿@model Volga_It.Hotels.Models.HotelDetailsModels
@{
    ViewBag.Title = "Подробная информация";
    Html.EnableClientValidation(true);
}

<h2>Подробная информация об отеле</h2>
<h3>
    @Html.DisplayTextFor(model => model.Name)
</h3>
<img id="hotelImage" style="align-content:center"/>
<div id="details">
    <span class="column">
        @Html.LabelFor(model => model.HotelId)
        @Html.DisplayTextFor(model => model.HotelId)
    </span>
    <span class="column">
        @Html.LabelFor(model => model.Country)
        @Html.DisplayTextFor(model => model.Country)
    </span>
    <span class="column">
        @Html.LabelFor(model => model.City)
        @Html.DisplayTextFor(model => model.City)
    </span>
    <span class="column">
        @Html.LabelFor(model => model.Area)
        @Html.DisplayTextFor(model => model.Area)
        </span>
    <span class="column">
        @Html.LabelFor(model => model.Stars)
        @Html.DisplayTextFor(model => model.Stars)
    </span>
    <span id="website" class="column">
        @Html.LabelFor(model => model.WebSite)
        <a href="@Html.DisplayTextFor(model => model.WebSite)">@Html.DisplayTextFor(model => model.WebSite)</a>       
    </span>
    <span class="column" style="width: 160px">
        @Html.LabelFor(model => model.AvgRating)
        @Html.DisplayTextFor(model => model.AvgRating)
    </span>
</div>
<div>
    <h3>Описание отеля</h3> 
    @Html.DisplayTextFor(model => model.Description)
</div>
<div>
    <h3>Оценки пользователей</h3>
    @foreach (var review in Model.previousReviews)
    {
        <p>
            @Html.Raw(review.Username) оценил как:            
            @Html.Raw(review.Comment) . Оценка: @Html.Raw(review.Rating)           
        </p>
    }
</div>

@using (Html.BeginForm("SendReview", "Home", FormMethod.Post))
{
    @Html.ValidationSummary(true)

    <fieldset>
        @Html.AntiForgeryToken()
        @Html.HiddenFor(model=>model.currentUserReview.HotelId)
        <h3>
            Оставьте свой отзыв об отеле!
        </h3>
        Ваше имя: @Html.EditorFor(model => model.currentUserReview.Username)
        @Html.ValidationMessageFor(model => model.currentUserReview.Username)
        <p>
            Напишите своё мнение об отеле:
        </p>
        @Html.EditorFor(model => model.currentUserReview.Comment)
        @Html.ValidationMessageFor(model => model.currentUserReview.Comment)
        <p>
            Оценка: @Html.EditorFor(model => model.currentUserReview.Rating) \ 5
        </p>
        <p>
            @Html.ValidationMessageFor(model => model.currentUserReview.Rating)
        </p>
        <input type="submit" value="Оставить отзыв" />      
    </fieldset>
}

@section scripts{
    <script type="text/javascript">        
        $("#hotelImage").attr('src', '@Model.ImageURL');
    </script>
    @Scripts.Render("~/bundles/jqueryval")
}
<style>
    .column {
        float: left;
        margin-right: 18px;        
    }
    #website {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 160px;
    }
    #details {
        margin-top: 20px;
        width: 100%;
        height: 60px;
    }
    #hotelImage{
        display: block;
        margin: 0 auto;
        margin-top: 20px;
        max-width: 100%;
    }
    #currentUserReview_Rating{
        width: 30px;
    }
</style>
